{extend name="common/main"}

{block name="css"}
<!-- 本页面需要额外添加的css请在此处添加 -->

<link rel="stylesheet" type="text/css" href="/mobiled/css/public.css"/>
<link rel="stylesheet" type="text/css" href="/mobiled/css/login.css"/>
<link rel="stylesheet" href="/mobiled/css/layer.css" type="text/css"/>

<style>
    body {
        font-size: 5px;
    }
</style>
<script type="text/javascript" src="/mobiled/js/jquery.js"></script>
<script src="/static/js/global.js"></script>
<script src="/static/js/mobile_common.js"></script>
<script type="text/javascript" src="/mobiled/js/layer.js" ></script>


{/block}

{block name="body"}
<body>
<header id="header" class='header'>
    <div class="h-left"><a href="javascript:history.back(-1)" class="sb-back"></a></div>
    <div class="h-mid">会员注册</div>
</header>
<div id="logRegTabCon">
    <div class="log_reg_item" id="phonearea">
        <form  form="submit" id="mobileForm" name="mobileForm" method="post" >
            <div class="field phone">
                <input type="text" id="username" name="mobile" placeholder="手机号" class="c-form-txt-normal" >
                <div class="tips">
                    <span id="mobile_phone_notice"></span>
                </div>
            </div>
            <div class="field pwd">
                <input type="password" id="password" name="password" placeholder="密码" class="c-form-txt-normal" >
                <div class="tips">
                    <span id="password_notice"></span>
                </div>
            </div>
            <div class="field pwd">
                <input type="password" id="password2" name="password2" placeholder="确认密码" class="c-form-txt-normal">
                <div class="tips">
                    <span id="confirm_password_notice"></span>
                </div>
            </div>
            <div class="field phone">
                <input type="text"  name="up_mobile" placeholder="推荐人手机号(可不填)" class="c-form-txt-normal" >
                <div class="tips">
                    <span id="mobile_phone_notice"></span>
                </div>
            </div>
            <div class="yanzheng" style=" margin-top:0px;">
                <div class="codeTxt">
                    <input type="text" id="mobile_code" name="mobile_code" placeholder="手机验证码">
                </div>
                <div class="codePhoto">
                    <input id="zphone" type="button" rel="mobile" value="获取手机验证码 " onclick="btnCheck()" class="zphone" style=" color:#FFF">
                </div>
            </div>
            <input type="submit" class="btn_big1" value="注 册">
        </form>
    </div>
</div>

{include file="common/bar"}
</body>
{/block}

{block name="js"}
{include file='common:validation'}
<script src="/layer/layer.js"></script>
<script>
    //提交订单
    function roleSubmit() {
        var form = document.getElementById("mobileForm");
        var formData = new FormData(form);
        $.ajax({
            url: "{:Url('regver')}",
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false, //不设置内容类型
            processData: false, //不处理数据
            success: function (res) {
                if (res.code != 200) {
                    layer.msg(res.msg,{shade: 0.5, time: 2000, icon: 2});
                    return false;
                }
                layer.msg(res.msg, {shade: 0.5, time: 2000, icon: 1}, function(){
                        window.location.href="{:url('login')}";//去支付页面
                        // window.location.href=document.referrer; //返回上一个页面并刷新
                });
            }
        })
    }

    /**
     * [btnCheck 按钮倒计时常用于获取手机短信验证码]
     */
    function btnCheck() {
        $mobile = $('[name="mobile"]').val();
        if ($mobile.length ==11){
            $.ajax({
                type : 'post',
                url : "{:url('vercod')}",
                data : {
                    'mobile':$mobile
                },
                success : function(res){
                    if (res.code != 200) {
                        layer.msg(res.msg,{shade: 0.5, time: 2000, icon: 2});
                        return false;
                    }
                    layer.msg(res.msg, {shade: 0.5, time: 2000, icon: 1}, function(){
                        $(this).addClass("on");
                        var time = 60;
                        $(this).attr("disabled", true);
                        var timer = setInterval(function() {
                            if (time == 0) {
                                clearInterval(timer);
                                $("#zphone").attr("disabled", false);
                                $("#zphone").val("获取验证码");
                                $("#zphones").removeClass("on");
                            } else {
                                $('#zphone').val(time + "秒");
                                time--;
                            }
                        }, 1000);
                    });

                }
            })
        }else{
            layer.msg('请输入11位手机号',{shade: 0.5, time: 2000, icon: 2});
        }

    }
</script>
<!-- 本页面需要额外添加的js请在此处添加 -->



{/block}